package cn.pfz.controller;


import cn.pfz.Service.IBusinessService;
import cn.pfz.Service.ISystemDictionaryItemSerives;
import cn.pfz.domain.Business;
import cn.pfz.domain.SystemDictionaryItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private IBusinessService businessService;

    @Autowired
    private ISystemDictionaryItemSerives systemDictionaryItemSerives;

    @RequestMapping("/index.html")
    public String show(Model model){
        List<Business> business= businessService.selectByMainStore(1);
        List <SystemDictionaryItem> systemDictionaryItemList= systemDictionaryItemSerives.selectByTpyeid(1);
        List<Business> businesses = businessService.selectAll();

        model.addAttribute("businesses",businesses);
        model.addAttribute("mainstore",business.get(0));
        model.addAttribute("systemDictionaryItems",systemDictionaryItemList);
        return "index";
    }

}
